package com.changli02._class;

import org.junit.Test;

import java.io.InputStream;
import java.util.Properties;

public class classTest  {
    @Test
    public void test() throws Exception {
        User u1= new User();
        Class clazz1 = u1.getClass();


        Class clazz2 = User.class;
        System.out.println(clazz1 == clazz2); //true

        String className = "com.changli02._class.User";  //******************
        Class clazz3 = Class.forName(className);
        System.out.println(clazz1 == clazz3);//true

        Class clazz4 = ClassLoader.getSystemClassLoader().loadClass("com.changli02._class.User");

        System.out.println(clazz1 == clazz4);//true

    }
    @Test
    public void test2() throws Exception {

        InputStream is = ClassLoader.getSystemClassLoader().getResourceAsStream("info.properties");
        Properties prop = new Properties();

        prop.load(is);
        System.out.println(prop.getProperty("name")+":"+prop.getProperty("password"));


    }
}
